package com.hc.server.actions;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import com.hc.server.Error;
import com.hc.server.IAction;
import com.hc.server.Request;
import com.hc.server.Response;

public class QUERY_REPASTS implements IAction{

	private static final String CITY = "CITY";
	private static final String PAGE_INDEX = "PAGE_INDEX";
	private static final String PAGE_SIZE = "PAGE_SIZE";

	private static final String NAME = "NAME";
	private static final String PHONE = "PHONE";
	private static final String ADD = "ADD";//地址
	private static final String KEY_WORD = "KEY_WORD";//关键字
	private static final String RPRICE = "RPRICE";//参考价格
	private static final String PIC = "PIC";//图片地址
	private static final String FEATURE = "FEATURE";//特色介绍
	
	private static final String REPASTS = "REPASTS";
	private static final String TOTAL_RESULT = "TOTAL_RESULT";
	
	@Override
	public void execute(Request req, Response resp) {
		String city;
		try {
			city = req.getStrArg(CITY);
		} catch (JSONException e) {
			resp.setErrResp(Error.INVALID_ARGS_ERR_CD, Error.INVALID_ARGS_ERR_MSG);
			return;
		}
		int pageIndex = req.optIntArg(PAGE_INDEX);
		int pageSize = req.optIntArg(PAGE_SIZE);
		
		JSONArray rests = new JSONArray();
		JSONObject rest = new JSONObject();
//		rest.put(NAME, value);
//		rest.put(PHONE, value);
//		rest.put(ADD, value);
//		rest.put(KEY_WORD, value);
//		rest.put(PIC, value);
//		rest.put(RPRICE, value);
//		rest.put(FEATURE, value);
		
		rests.put(rest);
		resp.appendRespContent(REPASTS, rests);
//		resp.appendRespContent(TOTAL_RESULT, value);
	}

}
